/*
	Copyright (C) 2010 2011 Rémi Thebault

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef GANTTATASK_H
#define GANTTATASK_H

#include <procycle/atomtask.h>

#include "gantttask.h"



class GanttATask : public GanttTask
{
public:
	GanttATask(ProCycle* app, PC::AtomTask* task, GanttCycle* gcycle, GanttMTask* parent=0);
	virtual ~GanttATask();

	QRectF boundingRect() const;

	virtual void paintTaskBar(QPainter* painter);

	virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
	virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
	virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
	virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
	virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);


	virtual bool pointOnTaskBar(const QPointF &p);

	virtual bool pointGrabsLength(const QPointF& p);

	PC::AtomTask* atask() {
		return static_cast<PC::AtomTask*>(m_task);
	}

	virtual int barTop() {
		return 7;
	}

	virtual int barHeight() {
		return 10;
	}

	virtual int linkDockY() {
		return 12;
	}

	virtual int barBottom() {
		return barTop()+barHeight();
	}

private:
	float	m_halfStep;
};

#endif // GANTTATASK_H
